home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / taylor < prev    next >
Text File  |  1995-03-31  |  2KB  |  79 lines

  1. Article 1927 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!usc!snorkelwacker!ai-lab!fruit-and-fibre!bson
  3. From: bson@fruit-and-fibre.ai.mit.edu (Jan Brittenson)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: TAYLRX - Taylor series for HP-48SX
  6. Message-ID: <11482@life.ai.mit.edu>
  7. Date: 21 Oct 90 04:12:21 GMT
  8. Sender: news@ai.mit.edu
  9. Organization: nil
  10. Lines: 65
  11.  
  12.  
  13.    This is a general Taylor program. It returns the Taylor series
  14. coinciding with a function at any given X. Not just at X=0 (i.e.
  15. Maclaurin series), like the built-in function TAYLR. It uses the
  16. SYSEVAL #546Dh to create the algebraic 'n!' where n is an arbitrary
  17. real. The SYSEVAL #54AFh is used to obtain the function ! and the
  18. short <2h>.
  19.  
  20.    The usage is identical to TAYLR (is TAYLR differentiable?) with an
  21. additional fourth argument, the X value.
  22.  
  23.    Two examples - the former a Maclaurin series, the latter a Taylor
  24. series at X=1:
  25.  
  26. Example 1.
  27.  
  28.     'EXP(X)' 'X' 3 0 TAYLRX
  29.     --> '1+X/1!+X^2/2!+X^3/3!'
  30.  
  31.     'EXP(X)' 'X' 3 TAYLR
  32.     --> '1+X+0.5*X^2+1/3!*X^3'
  33.  
  34. Example 2.
  35.  
  36.     'LN(X)' 'X' 5 1 TAYLRX
  37.     --> '(X-1)/1!-(X-1)/2!+2*(X-1)^3/3!-6*(X-1)^4/4!+24*(X-1)^5/5!'
  38.  
  39.     'LNT(X)' SWAP = DEFINE
  40.  
  41.     1.25 LN 1.25 LNT -
  42.     --> -.000033532019
  43.  
  44.  
  45. O  /
  46.  \/
  47.  /\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. O  \
  49.  
  50.  
  51. @ TAYLRX #8CD8h
  52.  
  53. @ General Taylor series
  54. @ f: function of dv
  55. @ dv: variable of differentiation
  56. @ N: polynomial degree
  57. @ pt: X value
  58. @ FC: !
  59. @ S3: <2h>
  60. @ c: degree counter
  61.  
  62. %%HP: T(3)A(R)F(,);
  63. \<< \-> f dv N pt
  64.   \<< '1!' # 54AFh SYSEVAL 
  65.       3 ROLL DROP
  66.       dv pt 2 \->LIST
  67.       \-> FC S3 dv0
  68.       \<< f dv0 |             @ start with f(pt)
  69.           1 N FOR c
  70.             f dv \.d 'f' STO        @ f'(dv) -> f
  71.             f dv0 | dv pt - c ^ *     @ 'f(pt)*(dv-pt)^c'
  72.             c FC S3 # 546Dh SYSEVAL / +    @ 'c!' / ; sum up
  73.           NEXT
  74.       \>>
  75.   \>>
  76. \>>
  77.  
  78.  
  79.